// 切换主题色

import { defineStore } from "pinia";
import type { ConfigProviderThemeVars } from "vant";
interface Theme {
  [key: string]: ConfigProviderThemeVars;
}
interface STATE {
  themes: Theme;
  currentTheme: string;
}

export const useThemeConfig = defineStore("themeConfig", {
  state: (): STATE => ({
    themes: {
      redTheme: {
        primaryColor: "#f4423e",
      },
      blueTheme: {
        primaryColor: "#00CFFD",
      },
    },
    currentTheme: 'redTheme',
  }),
  getters: {themeVars: (state): ConfigProviderThemeVars => state.themes[state.currentTheme],},
  actions: {
    changeThemeVars() {
      this.currentTheme = this.currentTheme === 'redTheme' ? 'blueTheme' : 'redTheme';
    },
  },
});

